﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Web;
using System.Web;
using DHQGHN.DAL.BO.TDT;
using DHQGHN.DAL.Models.DanhMuc;
using DHQGHN.DAL.Models.TDT;

namespace DHQGHN.Services.TDT
{
    public class HouseHoldPrintService : IHouseHoldPrintService
    {
        private HouseHoldPrintBO houseHoldPrintBO;
        log4net.ILog logger = log4net.LogManager.GetLogger(typeof(HouseHoldPrintService));

        #region Constructors
        /// <summary>
        /// 
        /// </summary>
        public HouseHoldPrintService()
        {
            //string connString = ConfigurationManager.ConnectionStrings["DHQGHN_TDT.ConnectionString"].ConnectionString;           
            houseHoldPrintBO = new HouseHoldPrintBO(DHQGHN.DAL.Common.ConnectionUtil.TKTHDS_TDT_CONNECTION_STRING);
        }
        #endregion

        public List<HOUSEHOLD_PRINT> GetByID(string houseHoldID)
        {
            try
            {
                if (!RoleChecking.CanAccess(WebOperationContext.Current.IncomingRequest.Headers))
                {
                    RoleChecking.ThrowUnauthorizedException();
                    return new List<HOUSEHOLD_PRINT>();
                }
                else
                {
                    return houseHoldPrintBO.Save(houseHoldID);
                }
            }
            catch(Exception ex)
            {
                logger.Error(ex.ToString());
                throw;
            }
        }
    }
}